package strings;

/**
 * 暴力匹配算法(brute force)
 *
 * @author yeyangtao created at 16:01 2020/10/16
 */
public class BruteForce {
    public boolean isExist(String source, String target) {
        int size = target.length();
        if (size > source.length()) return false;

        for (int i = 0; i < source.length(); i++) {
            String temp = source.substring(i, i + size + 1);
            if (temp.equals(target))
                return true;
        }
        return false;
    }
}
